unit Template;

interface

uses Classes;

type
  TSQLType = (sqlCreate, sqlTable, sqlView, sqlSequence, sqlProcedure,
    sqlInsertUpdate, sqlDelete, sqlTriggerBIU, sqlComment);

function GetTemplate(SQLType: TSQLType): string;

implementation

uses AppConst;

function GetTemplate(SQLType: TSQLType): string;
var
  sl: TStringList;
  FileName: string;
begin
  Result := '';
  case SQLType of
    sqlCreate:
      FileName := 'create.sql';

    sqlSequence:
      FileName := 'sequence.sql';

    sqlDelete:
      FileName := 'procedure_d.sql';

    sqlTriggerBIU:
      FileName := 'trigger_biu.sql';

  else
    FileName := '';
  end;

  if FileName <> '' then
  begin
    sl := TStringList.Create;
    try
      sl.LoadFromFile(AppTemplateDir + 'Database\' + FileName);
      Result := sl.Text;
    finally
      sl.Free;
    end;
  end;
end;

end.
